<?php
global $woodb;
$course_id = isset($_GET["course_id"]) ? $_GET["course_id"] : null;
$course = $woodb -> getCourseByID($course_id);
$lectures = $woodb->getLectures($course_id);

echo '
<div class="wrap" >
<h2>Lectures</h2>
<p></p>
<table id="lectures" cellspacing="0">
	<thead>
		<tr>
		    <th>Name</th>
		    <th>Date</th>
		    <th>Actions</th>
		</tr>
	</thead>
	<tfoot>
	    <tr>
		    <th>Name</th>
		    <th>Date</th>
		    <th>Actions</th>
	    </tr>
	</tfoot>
	<tbody>';
	foreach ($lectures as $l) {
		echo "<tr>
			<td onclick='jQuery(this).editLecture($course_id, $l->lecture_id)' class='edit_lecture'>$l->name</td>
			<td align='center'>".date("F j, Y \a\\t g:i a", strtotime($l->date))."</td>
			<td align='center'>
				<img onclick='jQuery(this).deleteLecture($l->lecture_id);' title='Delete Lecture' class = 'remove_lecture' style='height:22px; width:22px' src='" . get_bloginfo('wpurl') . "/wp-content/plugins/woodle/css/images/delete.png'/>
			</td>
			</tr>";
	}
	echo '
		</tbody>
		</table>
	</div>
	<p class="submit">
	<input onclick="jQuery(this).addLecture('.$course_id.')" type="submit" class="button-primary" value="Add Lecture" />
	</p>';
	
	

?>